/**
 * 
 */
package com.thon.dao.system.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.thon.dao.system.UserDao;
import com.thon.dao.util.AbstractDao;
import com.thon.dao.util.Page;
import com.thon.entity.system.User;

/**
 * @author thon
 * @email thon.ju@meet-future.com
 * @date 2011-11-10 14:18:53
 * @description:
 */
@Repository
public class UserDaoImpl extends AbstractDao<User> implements UserDao{
	
	public UserDaoImpl(){
		super(User.class);
	}

	@Override
	public User findByLoginName(String loginName, Integer delFlag) {
		String queryString = "FROM User u where u.loginName = ? and u.delFlag = ?";

		if (delFlag == null) {
			queryString = "FROM User u where u.loginName =?";
			return findOne(queryString, loginName);
		}

		return findOne(queryString, loginName, delFlag);
	}

	@Override
	public List<User> listAllUsers() {
		String queryString = "From User";
		return findList(queryString);
/*		String  sqlString = "select * from sys_user";
		return findListBySql(sqlString, null);*/
	}

}
